import React from 'react';
import RNBootSplash from 'react-native-bootsplash';
import {NavigationContainer, useNavigation} from '@react-navigation/native';
import Login from '../pages/Login';
import IndexTabs from './IndexTabs';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import Counter from '../samples/Counter';
import Movie from '../samples/Movie';
import List from '../samples/List';

const MainStack = () => {
  const Stack = createNativeStackNavigator();
  return (
    <NavigationContainer
      onReady={() => {
        RNBootSplash.hide({fade: true});
      }}>
      <Stack.Navigator
        initialRouteName={'Login'}
        screenOptions={{headerTitleAlign: 'center', headerBackTitle: '返回'}}>
        <Stack.Screen
          name={'Login'}
          component={Login}
          options={{headerShown: false}}
        />
        <Stack.Screen
          name={'Index'}
          component={IndexTabs}
          options={{headerShown: false}}
        />
        <Stack.Screen
          name={'Counter'}
          component={Counter}
          options={{title: 'Redux计时器'}}
        />
        <Stack.Screen
          name={'Movie'}
          component={Movie}
          options={{title: 'Redux异步调用'}}
        />
        <Stack.Screen
          name={'List'}
          component={List}
          options={{title: '下拉刷新上拉加载更多'}}
        />
      </Stack.Navigator>
    </NavigationContainer>
  );
};

export default MainStack;
